package test3;

class Person {
    public void eat() {}
}

class Northerners extends Person {
    public void eat() {
        System.out.println("北方人开始吃面");
    }
}

class Southerners extends Person {
    public void eat() {
        System.out.println("南方人开始吃面");
    }
}

class Cook {
    public void makeFood(Person p) {
        System.out.println("开始制作食物");
        p.eat();
    }
}

public class Test {
    public static void main(String[] args) {
        Northerners northerners = new Northerners();
        Southerners southerners = new Southerners();
        Cook cook = new Cook();
        cook.makeFood(northerners);
        cook.makeFood(southerners);
    }
}
